<?php $recent = $this->widget('Widget_Contents_Post_Recent', 'pageSize=5');
$index = 0; ?>
<div class="carousel">
    <!-- carousel locator -->
    <?php while ($recent->next()): ?>
        <?php $index += 1; ?>
        <?php if ($index === 1): ?>
            <input class="carousel-locator" id="slide-<?php echo ($index); ?>" type="radio" name="carousel-radio" hidden="" checked="">
        <?php else: ?>
            <input class="carousel-locator" id="slide-<?php echo ($index); ?>" type="radio" name="carousel-radio" hidden="">
        <?php endif; ?>
    <?php endwhile;
    $total = $index; ?>

    <!-- carousel container -->
    <div class="carousel-container">
        <!-- carousel item -->
        <?php $index = 0; ?>
        <?php while ($recent->next()): ?>
            <?php
            $index += 1;
            $url = getFirstCover($recent);
            ?>
            <figure class="carousel-item">
                <label class="item-prev btn btn-action btn-lg" for="slide-<?php echo ($index - 1); ?>"><i class="icon icon-arrow-left"></i></label>
                <!-- <?php echo ($index); ?> -->
                <label class="item-next btn btn-action btn-lg" for="slide-<?php echo ($index + 1); ?>"><i class="icon icon-arrow-right"></i></label>
                <div class="bg-image <?php echo $url === 'null' ? '-full' : ''; ?>" style="background-image:url('<?php echo $url === 'null' ? $this->options->themeUrl() . 'images/nopic.gif' : $url; ?>');" title="<?php $recent->title(); ?>">
                    <div class="-inner c-hand" onclick="location.href='<?php $recent->permalink(); ?>';">
                        <div class="-icon -link"></div>
                        <div class="text-large ml-2 text-black text-ellipsis"><?php $recent->title(); ?></div>
                    </div>
                </div>
            </figure>
        <?php endwhile; ?>
    </div>
    <!-- carousel navigation -->
    <div class="carousel-nav">
        <?php $index = 0; ?>
        <?php while ($recent->next()): ?>
            <?php $index += 1; ?>
            <label class="nav-item text-hide c-hand" for="slide-<?php echo ($index); ?>"><?php echo ($index); ?></label>
        <?php endwhile; ?>
    </div>
</div>